﻿//========================================
// All rights reserved (C) 2017-2100
// CLR 版本：	4.0.30319.42000
// 命名空间:	SFJDService
// 文 件 名：	ClassActive
// 作    者：	WooG
// 联系方式：	wooglle@163.com
// 创建时间：	2017/10/3 17:41:30
//========================================
using Common;
using System;
using System.Text;

namespace SFJDService
{
    public class ClassActive
    {
        private ClassData data = new ClassData();

        /// <summary>
        /// GUID
        /// </summary>
        public Guid Guid
        {
            set;
            get;
        }

        /// <summary>
        /// IP地址
        /// </summary>
        public string Ip
        {
            set;
            get;
        }

        /// <summary>
        /// 用户姓名
        /// </summary>
        public string Name
        {
            set;
            get;
        }

        /// <summary>
        /// 缓存的划号数据
        /// </summary>
        public ClassData Data
        {
            set { data = value; }
            get { return data; }
        }

        /// <summary>
        /// 委托人文件大小
        /// </summary>
        public long BrigadeSize
        {
            set;
            get;
        }

        /// <summary>
        /// 联系人文件大小
        /// </summary>
        public long ContactSize
        {
            set;
            get;
        }

        /// <summary>
        /// 最后一次响应时间
        /// </summary>
        public DateTime LastResponse
        {
            set;
            get;
        }

        /// <summary>
        /// 软件版本
        /// </summary>
        public Version Version
        {
            set;
            get;
        }

        /// <summary>
        /// 复制此类
        /// </summary>
        /// <param name="active"></param>
        public void Clone(ClassActive active)
        {
            if (active == null)
            {
                Ip = null;
            }
            else
            {
                Ip = active.Ip;
                Name = active.Name;
                data.Clone(active.data);
                BrigadeSize = active.BrigadeSize;
                ContactSize = active.ContactSize;
                LastResponse = active.LastResponse;
                Version = active.Version;
            }
        }

        public override string ToString()
        {
            StringBuilder b = new StringBuilder();
            b.Append(Guid);
            b.Append(", " + Ip);
            b.Append(", " + Name);
            b.Append(", " + Version);
            b.Append(", " + BrigadeSize);
            b.Append(", " + ContactSize);
            b.Append(", " + LastResponse);
            b.Append(", " + Data.CodingToString());
            return b.ToString();
        }
    }
}
